﻿<script id="articleEditTemplate" type="text/template">
    <form class="form-horizontal" role="form" id="editPanel">
        <div class="form-group">
            <label for="name" class="col-xs-1 control-label">Name</label>
            <div class="col-xs-6">
                <input type="text" class="form-control" id="name" ng-bind="item.Name" ng-model="item.Name">
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-xs-1 control-label">Type</label>
            <div class="col-xs-6">
                <select class="form-control" ng-model="item.TypeID" ng-change="setColumnListVisibility()">
                    <option value="1">Simple</option>
                    <option value="2">Tabular</option>
                </select>
            </div>
        </div>
        <button type="submit" class="btn btn-default" ng-click="save()"><span class="glyphicon glyphicon-floppy-save"></span></button>
        <button type="submit" class="btn btn-default" ng-click="cancel()"><span class="glyphicon glyphicon-remove-sign"></span></button>
    </form>

    <div ng-show="isColumnListVisible">
        <h3>Fields</h3>    
        <table class="table table-striped table-hover table-condensed">
            <tbody>
                <tr ng-repeat="item in list" ng-class="{success: $index==selectedIndex}">
                    <td ng-bind="item.Name" class="col-xs-6"></td>
                    <td class="col-xs-2">
                        <button ng-click="edit($index)" class="btn btn-default"><span class="glyphicon glyphicon-edit"></span></button>
                        <button ng-click="remove($index)" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span></button>
                    </td>
                </tr>
            </tbody>
        </table>
        @Html.Partial("Article/_ColumnEdit")    
    </div>
</script>